`include "instructions.vh"
module instruction_decoder(i_instr, o_instr_class);
input [31:0] i_instr;
output reg [`NUM_INSTR-1:0] o_instr_class;
always @* begin
  casez (i_instr)
    32'b0???000000??????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b0???00000??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00000??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00001??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00001??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00001???????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b0???0001001011111111111100?1????: o_instr_class = 1<<`INSTR_BX;
    32'b0???00010?001111????000000000000: o_instr_class = 1<<`INSTR_MRS;
    32'b0???00010?10????111100000000????: o_instr_class = 1<<`INSTR_MSR;
    32'b0???00011??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00011??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b0???000????1????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b0???000????1???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b0???000?????????????????1011????: o_instr_class = 1<<`INSTR_LSX;
    32'b0???000?????????????????1101????: o_instr_class = 1<<`INSTR_LSX;
    32'b0???000?????????????????1111????: o_instr_class = 1<<`INSTR_LSX;
    32'b0???00100??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00101??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b0???00110000????????????????????: o_instr_class = 1<<`INSTR_MOVW;
    32'b0???00110100????????????????????: o_instr_class = 1<<`INSTR_MOVT;
    32'b0???00110?10????1111????????????: o_instr_class = 1<<`INSTR_MSR;
    32'b0???00111??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b0???001????1????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b0???010?????????????????????????: o_instr_class = 1<<`INSTR_LS;
    32'b0???01101?11??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b0???01101??0??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b0???01111?1??????????????101????: o_instr_class = 1<<`INSTR_BFX;
    32'b0???011????????????????????0????: o_instr_class = 1<<`INSTR_LS;
    32'b0???100?????????????????????????: o_instr_class = 1<<`INSTR_LSM;
    32'b0???101?????????????????????????: o_instr_class = 1<<`INSTR_B;
    32'b0???1111????????????????????????: o_instr_class = 1<<`INSTR_SWI;
    32'b10??000000??????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b10??00000??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00000??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00001??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00001??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00001???????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b10??0001001011111111111100?1????: o_instr_class = 1<<`INSTR_BX;
    32'b10??00010?001111????000000000000: o_instr_class = 1<<`INSTR_MRS;
    32'b10??00010?10????111100000000????: o_instr_class = 1<<`INSTR_MSR;
    32'b10??00011??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00011??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b10??000????1????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b10??000????1???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b10??000?????????????????1011????: o_instr_class = 1<<`INSTR_LSX;
    32'b10??000?????????????????1101????: o_instr_class = 1<<`INSTR_LSX;
    32'b10??000?????????????????1111????: o_instr_class = 1<<`INSTR_LSX;
    32'b10??00100??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00101??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b10??00110000????????????????????: o_instr_class = 1<<`INSTR_MOVW;
    32'b10??00110100????????????????????: o_instr_class = 1<<`INSTR_MOVT;
    32'b10??00110?10????1111????????????: o_instr_class = 1<<`INSTR_MSR;
    32'b10??00111??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b10??001????1????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b10??010?????????????????????????: o_instr_class = 1<<`INSTR_LS;
    32'b10??01101?11??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b10??01101??0??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b10??01111?1??????????????101????: o_instr_class = 1<<`INSTR_BFX;
    32'b10??011????????????????????0????: o_instr_class = 1<<`INSTR_LS;
    32'b10??100?????????????????????????: o_instr_class = 1<<`INSTR_LSM;
    32'b10??101?????????????????????????: o_instr_class = 1<<`INSTR_B;
    32'b10??1111????????????????????????: o_instr_class = 1<<`INSTR_SWI;
    32'b110?000000??????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b110?00000??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00000??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00001??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00001??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00001???????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b110?0001001011111111111100?1????: o_instr_class = 1<<`INSTR_BX;
    32'b110?00010?001111????000000000000: o_instr_class = 1<<`INSTR_MRS;
    32'b110?00010?10????111100000000????: o_instr_class = 1<<`INSTR_MSR;
    32'b110?00011??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00011??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b110?000????1????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b110?000????1???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b110?000?????????????????1011????: o_instr_class = 1<<`INSTR_LSX;
    32'b110?000?????????????????1101????: o_instr_class = 1<<`INSTR_LSX;
    32'b110?000?????????????????1111????: o_instr_class = 1<<`INSTR_LSX;
    32'b110?00100??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00101??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b110?00110000????????????????????: o_instr_class = 1<<`INSTR_MOVW;
    32'b110?00110100????????????????????: o_instr_class = 1<<`INSTR_MOVT;
    32'b110?00110?10????1111????????????: o_instr_class = 1<<`INSTR_MSR;
    32'b110?00111??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b110?001????1????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b110?010?????????????????????????: o_instr_class = 1<<`INSTR_LS;
    32'b110?01101?11??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b110?01101??0??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b110?01111?1??????????????101????: o_instr_class = 1<<`INSTR_BFX;
    32'b110?011????????????????????0????: o_instr_class = 1<<`INSTR_LS;
    32'b110?100?????????????????????????: o_instr_class = 1<<`INSTR_LSM;
    32'b110?101?????????????????????????: o_instr_class = 1<<`INSTR_B;
    32'b110?1111????????????????????????: o_instr_class = 1<<`INSTR_SWI;
    32'b1110000000??????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b111000000??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b111000000??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b111000001??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b111000001??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b111000001???????????????1001????: o_instr_class = 1<<`INSTR_MUL;
    32'b11100001001011111111111100?1????: o_instr_class = 1<<`INSTR_BX;
    32'b111000010?001111????000000000000: o_instr_class = 1<<`INSTR_MRS;
    32'b111000010?10????111100000000????: o_instr_class = 1<<`INSTR_MSR;
    32'b111000011??0????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b111000011??0???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b1110000????1????????????0??1????: o_instr_class = 1<<`INSTR_DP;
    32'b1110000????1???????????????0????: o_instr_class = 1<<`INSTR_DP;
    32'b1110000?????????????????1011????: o_instr_class = 1<<`INSTR_LSX;
    32'b1110000?????????????????1101????: o_instr_class = 1<<`INSTR_LSX;
    32'b1110000?????????????????1111????: o_instr_class = 1<<`INSTR_LSX;
    32'b111000100??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b111000101??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b111000110000????????????????????: o_instr_class = 1<<`INSTR_MOVW;
    32'b111000110100????????????????????: o_instr_class = 1<<`INSTR_MOVT;
    32'b111000110?10????1111????????????: o_instr_class = 1<<`INSTR_MSR;
    32'b111000111??0????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b1110001????1????????????????????: o_instr_class = 1<<`INSTR_DP;
    32'b1110010?????????????????????????: o_instr_class = 1<<`INSTR_LS;
    32'b111001101?11??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b111001101??0??????????000111????: o_instr_class = 1<<`INSTR_EXT;
    32'b111001111?1??????????????101????: o_instr_class = 1<<`INSTR_BFX;
    32'b1110011????????????????????0????: o_instr_class = 1<<`INSTR_LS;
    32'b1110100?????????????????????????: o_instr_class = 1<<`INSTR_LSM;
    32'b1110101?????????????????????????: o_instr_class = 1<<`INSTR_B;
    32'b11101111????????????????????????: o_instr_class = 1<<`INSTR_SWI;
    32'b111100010000???00000000???0?????: o_instr_class = 1<<`INSTR_CPS;
    default: o_instr_class = 1;
  endcase
end
endmodule
